# 导入:
from sqlalchemy import Column, String, create_engine, BIGINT, Integer,DateTime,Date,Text
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base


# 创建对象的基类:
Base = declarative_base()

# 定义目录对象:
class Catalog(Base):
    # 表的名字:
    __tablename__ = 'tb_catalog'

    # 表的结构:
    id = Column(Integer, primary_key=True)
    name = Column(String(255))
    parent_id = Column(Integer)
    full_name = Column(String(2048))
    level = Column(Integer)
    level_name = Column(String(50))
    eng_name = Column(String(255))


class Plant(Base):
    __tablename__ = "tb_plant"
    id = Column(Integer, primary_key=True)
    name = Column(String(255))
    alias_name = Column(String(255))
    latin_name = Column(String(255))
    catalog_id = Column(Integer)
    catalog_name = Column(String(255))
    abstract = Column(String(5000))
    keys = Column(String(255))
    keys_script = Column(String(5000))
    content=Column(Text)

class Image(Base):
    __tablename__ = "tb_plant_image"
    id = Column(Integer, primary_key=True)
    plant_id = Column(Integer)
    image_url = Column(String(255))
    create_userid = Column(Integer)
    create_date = Column(Date)
    auth_flag = Column(Integer)
